/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rational.parser.type.standart;

import org.rational.parser.type.wraps.TrimType;

/**
 *
 * @author Overmind
 */
public class Logical
    extends TrimType<Boolean>
{    
    public Logical()
    {
        super("Logical");
    }
    
    @Override
    public Boolean valueOfTrimString(String string) throws NumberFormatException
    {
        if (string.equalsIgnoreCase("TRUE"))
        {
            return true;
        } else
        {
            if (string.equalsIgnoreCase("FALSE"))
            {
                return false;
            } else
            {
                throw new NumberFormatException();
            }
        }
    }

    @Override
    public String objectToString(Boolean value)
    {
        return value.toString().toUpperCase();
    }
}
